package com.cliang.tools.db;

import com.cliang.tools.db.DB;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

/**
 * 数据库语句处理工具类
 */
public class DBUtils {
    private Connection conn;
    private PreparedStatement psmt=null;

    public DBUtils() {
    }

    public DBUtils(Connection conn) {
        this.conn = conn;
    }

    public Connection getConnection() throws SQLException {
        if(this.conn==null || this.conn.isClosed()){
            this.conn= DB.getConnection();
        }
        return conn;
    }

    public void setConnection(Connection conn) {
        this.conn = conn;
    }


}
